//
//  MBAToast.swift
//  bang
//
//  Created by mba on 16/10/13.
//  Copyright © 2016年 mbalib. All rights reserved.
//

import UIKit
import Toaster

let kSERERROR = "服务端出差了，请稍后重试"
let kNETERROR = "当前网络不可用，请查看网络设置"

class MBAToast: UILabel {
    
    class func show(text: String,delay: TimeInterval = 0,duration: TimeInterval = 2) {
        ToastView.appearance().bottomOffsetPortrait = 100
        ToastView.appearance().backgroundColor = UIColor.black
        ToastView.appearance().useSafeAreaForBottomOffset = true
        ToastView.appearance().font = UIFont.systemFont(ofSize: 16)
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.47){//不能调小了
            Toast(text: text, delay: delay, duration: duration).show()
        }
    }
    
    class func showToastNetError(){
        MBAToast.show(text: kNETERROR)
    }
    class func showToastSerError(){
        MBAToast.show(text: kSERERROR)
    }
}
